package com.contory.ssn_lgnd.app.maingame;

import com.contory.ssn_lgnd.app.comp.DrawPtr;
import com.contory.ssn_lgnd.app.comp.UpdatePtr;
import com.contory.ssn_lgnd.app.comp.ViewObject;
import com.contory.ssn_lgnd.framework.gl.Animation;
import com.contory.ssn_lgnd.framework.gl.SpriteBatcher;
import com.contory.ssn_lgnd.framework.gl.TextureRegion;

public class TextureEffect implements UpdatePtr, DrawPtr{
	ViewObject view;
	float a = 1;
	byte state = 0;
	boolean enableBool = true;
	
	public TextureEffect(float x, float y, float w, float h, TextureRegion tr){
		view = new ViewObject();
		view.setXY_WH_TR(x, y, w, h, tr);
	}
	
	public void setInit(float x, float y){
		view.x = x;
		view.y = y;
		state = 0;
		enableBool = true;
		a= 1;
	}

	@Override
	public void update(float deltaTime) {
		if(!enableBool)
			return;
		switch(state){
			case 0:
				a -= deltaTime * 2;
				if(a < 0){
					enableBool = false;
					state = 1;
				}
			break;
			case 1:
			break;
		}
	}
	
	public boolean getEffectBool(){
		return enableBool;
	}

	@Override
	public void draw(SpriteBatcher batcher) {
		batcher.drawSprite(view.x, view.y, view.w, view.h, 1, 1, 1, a, view.tr);
	}
}
